//
//  UIButton+Manager.m
//  WorkManager
//
//  Created by ukongm on 17/2/7.
//  Copyright © 2017年 ukongm. All rights reserved.
//

#import "UIButton+Manager.h"
#import "XFManager.h"
@implementation UIButton (Manager)

+(instancetype)smallBtnForFrame:(CGRect)frame{
    UIButton* button = [[UIButton alloc] initWithFrame:frame];
    
    [button setTitleColor:[UIColor red:80 green:80 blue:80] forState:UIControlStateNormal];
    button.titleLabel.font = [UIFont systemFontOfSize:12];
    
    return button;
}

- (void)countAdd{
    
    [self countManagerForType:1];
}

- (void)countSubtract{
    [self countManagerForType:-1];
}

- (void)countManagerForType:(NSInteger)type{
    NSString* title = [self titleForState:UIControlStateNormal];
    
    NSInteger count = title.integerValue;
    
    count = count + type;
    
    [self setTitle:[@" " stringByAppendingString:XFIntegerToString(count)] forState:UIControlStateNormal];
}

@end
